#!/usr/bin/env python
# $Id: backup.py acabbce13f25 2012/11/11 02:33:52 pgurumur $
# Copyright (c) 2012 Prabhu Gurumurthy <pgurumur@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# File backup.py generated on Sunday September 09, 2012 @ 11:13:43 PDT
#

__version__  = "$Revision: acabbce13f25 $"
__author__   = "$Author: pgurumur $"
__modified__ = "$Date: 2012-11-11 02:33:52Z $"

import optparse
import os
import sys

from pyparsing import Suppress
from venya.lib import cmdparser, ip, exception, stdlib, snmp

class Parser(object):
   def __init__(self):
      super(stdlib.my_class(self), self).__init__()
      self._lb, self._rb = map(Suppress, "{}")
      self._lp, self._rp = map(Suppress, "()")
      self._lbk, self._rbk = map(Suppress, "[]")
      self._lt, self._gt = map(Suppress, "<>")

class backup(cmdparser.GetOpt):
   option_list = (
         optparse.make_option("-c", "--community", type = "str",
            help = "SNMP r/w community string", default = "private",
            dest = "community"),
         optparse.make_option("-C", "--config", type = "str",
            help = "Configuration file", default = "backup.cfg",
            dest = "config"),
   ) + cmdparser.GetOpt.option_list

   usage = "[ options ] device"
   help = """

   Python program to backup Cisco network device using SNMP

   """

   def __init__(self, *args, **kwargs):
      super(stdlib.my_class(self), self).__init__(*args, **kwargs)
      self._snmp = None

   @cmdparser.getopts
   def handle(self):
      hosts = []
      try:
         hosts = self.arguments[1:]
      except IndexError as err:
         pass

if __name__ == "__main__":
   bkup = None
   try:
      bkup = backup(version = 1.0, args = sys.argv)
      bkup.handle()
   except exception.GetOptError as err:
      print(err)
      sys.exit(1)
